package com.usian.wemedia.controller;

import com.usian.apis.wemedia.MaterialManageControllerApi;
import com.usian.common.constans.wemedia.WemediaContans;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.media.dtos.WmMaterialDto;
import com.usian.wemedia.service.MaterialManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/api/v1/material")
@RestController
public class MaterialManageController implements MaterialManageControllerApi {
@Autowired
private MaterialManageService materialManageService;
    @Override
    @PostMapping("/findList")
    public ResponseResult findList(@RequestBody WmMaterialDto dto) {
        return materialManageService.findList(dto);
    }

    @Override
    @GetMapping("/delPicture/{id}")
    public ResponseResult delPicture(@PathVariable("id") Integer id) {
        return materialManageService.delPicture(id);
    }

    @GetMapping("/cancel_collect/{id}")
    @Override
    public ResponseResult cancleCollectionMaterial(@PathVariable Integer id) {
        return materialManageService.cancleCollectionMaterial(id, WemediaContans.COLLECT_MATERIAL);
    }

    @Override
    @GetMapping("/collect/{id}")
    public ResponseResult collectionMaterial(@PathVariable Integer id) {
        return materialManageService.collectionMaterial(id,WemediaContans.CANCEL_COLLECT_MATERIAL);
    }
}
